﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4_NovaAdmin.Web.Core.ServiceExtensions
{
    /// <summary>
    /// Cors 启动服务
    /// </summary>
    public static class CorsSetup
    {
        public static void AddCors(this IServiceCollection services)
        {
            ArgumentNullException.ThrowIfNull(services);
            services.AddCors(options =>
            {
                options.AddPolicy("cors",
                    policy => policy.AllowAnyOrigin()
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                );
            });
        }
    }
}
